﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <style>
        .manager-img-link {
            width: 100%;
            height: 100%;
        }

        #Homecontainer {
            padding-bottom: 15px
        }
        .manager-img-link a {
            display: block;
            width: 100%;
            height: 100%;
            padding:1px 10px 1px 5px;
        }
        #Homecontainer a {
            display: block;
            width: 100%;
            height: 100%;
        }
        .manager-img-link a img {
            width: 95%;
            height: 100%;
            padding: 5px 20px;
        }
        #Homecontainer div > a {
            padding-top: 10px;
            padding-bottom: 10px
        }
        #Homecontainer div > img {
                padding-top: 20px;
                padding-bottom: 10px;
                width: 100%;
            }

        #Homecontainer2 div > .layui-col-md6 {
            padding-right: 20px
        }

        #current_Time .layui-laydate-main {
            width: 310px;
            height: 230px
        }

        #current_Time .layui-laydate-content td, #current_Time .layui-laydate-content th {
            width: 50px
        }
        .layui-col-md3 .lldate{
            margin-left:65px;
            margin-top:20px;
        }
    </style>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
    <link href="../lib/layui/css/layui.css" rel="stylesheet" />
    <script src="../lib/layui/layui.js"></script>

    <!--<script src="../static/js/jquery.js"></script>
    <script src="../static/js/jsapi.js"></script>
    <script src="../static/js/corechart.js"></script>
    <script src="../static/js/jquery.gvChart-1.0.1.min.js"></script>
    <script src="../static/js/jquery.ba-resize.min.js"></script>-->

</head>
<body>
    <div id="Homecontainer" class="layui-container" style="width:100%;">
        <div class="layui-row">
            <div class="layui-col-md3">
                <div class="manager-img-link"><a href="/views/base/employeeset.html"><img src="../static/images/baseinfo.png" /></a></div>
                <div class="manager-img-link"><a href="/views/trainfiles/filemgr.html"><img src="../static/images/peixunkecheng.png" /></a></div>
            </div>
            <div class="layui-col-md3">
                <div class="manager-img-link"><a href="/views/plan/trainplan.html"><img src="../static/images/peixunjihua.png" /></a></div>
                <div class="manager-img-link"><a href="/views/search/uncommittedPersonDetail.html"><img src="../static/images/chaxuntongji.png" /></a></div>
            </div>
            <div class="layui-col-md3">
                <div class="manager-img-link"><a href="/views/traincontent/traincourseset.html"><img src="../static/images/shoukeneirong.png" /></a></div>
                <div class="manager-img-link"><a href="/views/search/AttendanceCount.html"><img src="../static/images/chuqin.png" /></a></div>
            </div>
            <div class="layui-col-md3" style="">
                <div class="lldate">
                    <div class="layui-laydate laydate-gray">
                        <div id="current_Time"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="Homecontainer2" class="layui-container" style="width:100%;">
        <div class="layui-row">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-colla-title layui-bg-blue">消息列表</div>
                    <div class="layui-card-body">
                        <div class="layui-collapse lay-accordion">
                            <div class="layui-colla-item">
                                <div class="layui-colla-title">最新消息</div>
                                <div class="layui-colla-content layui-show" id="LastMessage">

                                </div>
                            </div>

                            <div class="layui-colla-item">
                                <div class="layui-colla-title">消息列表</div>
                                <div class="layui-colla-content layui-show">
                                    <table id="dataList" lay-filter="dataList"></table>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
            <div class="layui-col-md6 ">
                <div class="layui-card">
                    <div class="layui-colla-title layui-bg-blue">量化指标</div>
                    <div class="layui-card-body" style="overflow:auto;">
                        <div class="layui-col-md6">
                            <div class="layui-card">
                                <div class="layui-colla-title">本月学习未达标人员情况</div>
                                <div class="layui-colla-content layui-show">
                                    <table id="dataList2" lay-filter="dataList2" style="width:100%"></table>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-card">
                                <div class="layui-colla-title">本月课程情况</div>
                                <div id="chart">
                                       <iframe src="" style="width:100%;height:400px;border:none;" scrolling="no"></iframe>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

</body>
</html>
<script id="barDemo" type="text/html">
    <a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
</script>
<script>
    var contollerName = "MessageInfo";
    layui.use(['form', 'laydate', 'table', 'jquery', 'element', 'layer', 'tree', 'util'], function () {
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var table = layui.table;
        var element = layui.element;
        laydate.render({
            elem: '#current_Time'
            , position: 'static'
            , btns: []
        });

        function showMessageList() {
            var swhere = JSON.stringify({
                TPName: "",
                //TPReleaseStart: $("#TPReleaseStart").val(),
                //TPReleaseEnd: $("#TPReleaseEnd").val(),
                //TPDescribe: $("#TPDescribe").val(),
                ////TPIsRelease: $("#TPIsRelease").val(),
                //IsUse: 1,
                //self: 0
            });
            table.render({
                elem: '#dataList'
                , url: ApiUrl + contollerName + '/Search'
                , id: "dataList"
                , headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                }
                , page: true
                , cols: [[
                    //{ type: 'checkbox' },
                    { field: 'MsgID', title: 'MsgID', sort: true, hide: true },
                    { field: 'MsgTitle', title: '消息名称', width: 200, hide: true  },
                    { field: 'MsgContent', title: '消息内容', sort: true, width: 300 },
                    { field: 'MsgAddTime', title: '添加时间', sort: true, hide: true },
                    //{ field: 'MsgStartTime', title: 'MsgStartTime', sort: true, hide: true },
                    //{ field: 'MsgEndTime', title: 'MsgEndTime', sort: true, hide: true },
                    { field: 'MsgReleaseUserID', title: 'MsgReleaseUserID', sort: true, hide: true },
                    { field: 'MsgReleaseUserName', title: 'MsgReleaseUserName', sort: true, hide: true },
                    { field: 'MsgType', title: 'MsgType', sort: true, hide: true },
                    { field: 'CurDepID', title: 'CurDepID', sort: true, hide: true },
                    { field: 'CurDepName', title: 'CurDepName', sort: true, hide: true },
                    {
                        field: 'MsgStartTime', title: '开始日期', width: 120, templet: function (d) {
                            return d.MsgStartTime.substring(0, 10);
                        },
                    },
                    {
                        field: 'MsgEndTime', title: '结束日期', width: 120, templet: function (d) {
                            return d.MsgEndTime.substring(0, 10);
                        },
                    },
                    { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 80 },
                ]]
                , where: { swhere: swhere }
                , parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": res.StatusCode, //解析接口状态
                        "msg": res.Info, //解析提示文本
                        "count": res.Count, //解析数据长度
                        "data": res.Data //解析数据列表
                    };
                },
                response: { statusCode: 200 },//规定成功的状态码，默认：0
                event: true,
                page: true,
                done: function (res, curr, count) {
                    //如果是异步请求数据方式，res即为你接口返回的信息。
                    //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                    if (res.data != null) {
                        var p = $(".layui-laypage-skip").find("input[type=text]").val();
                        var c = $(".layui-laypage-limits select").find("option:selected").text().substring(0, 2);
                        var k = (Number(p) - 1) * Number(c);
                        for (var i = 0; i < res.data.length; i++) {
                            var item = res.data[i];
                            var ix = item.Row - 1 - k;
                            $(".layui-table-body table tbody tr[data-index=" + ix + "]").attr("style", dataRowColor[item.TPDepLevel]);
                        }
                    }
                    if (res.code == 403) {
                        layer.alert(res.msg, function () {
                            top.location.href = "http://" + top.location.host + "/login.html";
                        })
                    }
                }
            });
        }
        showMessageList();

        //监听行工具事件
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            if (obj.event === 'detail') {
                var edit = layer.open({
                    type: 2,
                    title: "消息内容",
                    area: ['700px', '450px'],
                    //fixed: false, //不固定
                    //maxmin: true,
                    content: './MessageDetail.html?' + "MsgID=" + obj.data.MsgID + "&MsgContent=" + obj.data.MsgContent + "&MsgStartTime=" + obj.data.MsgStartTime + "&MsgEndTime=" + obj.data.MsgEndTime +"&MsgTitle="+obj.data.MsgTitle,
                    end: function () {
                        location.reload();
                    }
                });
                //layer.full(edit);
            }
        });

        function GetLastMesg() {
            $.ajax({
                url: ApiUrl + contollerName + '/GetSingleInfo',
                type: 'GET',
                headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                },
                success: function (data) {
                    if (data.StatusCode == 200) {
                        if (data.Data != null) {
                            $("#LastMessage").append(data.Data[0].MsgContent);
                        }
                        else {
                            $("#LastMessage").append("没有消息！");
                        }
                    }
                    else if (data.StatusCode == 403) {
                        layer.alert(data.Info, function () {
                            top.location.href = "http://" + top.location.host + "/login.html";
                        })
                    }
                    else {
                        layer.msg(data.Info);
                    }
                }
            });
        }
        GetLastMesg();

        //====================================================================================
        function GetStudy() {
            $.ajax({
                url: ApiUrl + '/TrainCourse/GetPersonStrudyReport',
                type: 'GET',
                headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                },
                success: function (data) {
                    if (data.StatusCode == 200) {
                        if (data.Data != null) {
                            $("#chart").find("iframe").attr("src", "../static/index.html?w=" + data.Data.w + "&y=" + data.Data.y + "&z=" + data.Data.t + "");
                        }
                       
                    }
                    else if (data.StatusCode == 403) {
                        layer.alert(data.Info, function () {
                            top.location.href = "http://" + top.location.host + "/login.html";
                        })
                    }
                    else {
                        layer.msg(data.Info);
                    }
                }
            });
        }
        GetStudy();

        function showStudyList() {
            //var swhere = JSON.stringify({
            //    TPName: "",
            //    //TPReleaseStart: $("#TPReleaseStart").val(),
            //    //TPReleaseEnd: $("#TPReleaseEnd").val(),
            //    //TPDescribe: $("#TPDescribe").val(),
            //    ////TPIsRelease: $("#TPIsRelease").val(),
            //    //IsUse: 1,
            //    //self: 0
            //});
            table.render({
                elem: '#dataList2'
                , url: ApiUrl + '/TrainCourse/GetCourseStudyReaching'
                , id: "dataList2"
                , headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                }
                , page: false
                , cols: [[
                    { field: 'DepName', title: '部门'},
                    { field: 'xcount', title: '学习人员', width: 90 },
                    { field: 'ycount', title: '已达标', width: 80 },
                    { field: 'wcount', title: '未达标', width:80 },

                  
                ]]
                //, where: { swhere: swhere }
                , parseData: function (res) { //res 即为原始返回的数据
                    return {
                        "code": res.StatusCode, //解析接口状态
                        "msg": res.Info, //解析提示文本
                        "count": res.Count, //解析数据长度
                        "data": res.Data //解析数据列表
                    };
                },
                response: { statusCode: 200 },//规定成功的状态码，默认：0
                event: true,
                page: false,
                done: function (res, curr, count) {
                    //如果是异步请求数据方式，res即为你接口返回的信息。
                    //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                    if (res.data != null) {
                        
                    }
                    if (res.code == 403) {
                        layer.alert(res.msg, function () {
                            top.location.href = "http://" + top.location.host + "/login.html";
                        })
                    }
                }
            });
        }
        showStudyList();

    });
</script>